home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World Komputer 2010 April
/
PCWorld0410.iso
/
hity wydania
/
Ubuntu 9.10 PL
/
karmelkowy-koliberek-desktop-9.10-i386-PL.iso
/
casper
/
filesystem.squashfs
/
usr
/
bin
/
byobu-status
< prev
next >
Wrap
Text File
|
2009-10-11
|
2KB
|
63 lines
#!/bin/sh -e
#
# byobu-status
# Copyright (C) 2008 Canonical Ltd.
#
# Authors: Dustin Kirkland <kirkland@canonical.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, version 3 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
PKG="byobu"
find_script () {
# Allow for local status scripts
if [ -x "$HOME/.$PKG/bin/$1" ]; then
echo "$HOME/.$PKG/bin/$1"
elif [ -x "/usr/lib/$PKG/$1" ]; then
echo "/usr/lib/$PKG/$1"
else
echo "/bin/true"
fi
}
# Source configurations
[ -r "/etc/$PKG/statusrc" ] && . "/etc/$PKG/statusrc"
[ -r "$HOME/.$PKG/status" ] && . "$HOME/.$PKG/status"
[ -r "$HOME/.$PKG/statusrc" ] && . "$HOME/.$PKG/statusrc"
export P="$1"
if [ "$P" = "--detail" ]; then
VER=
if which dpkg-query >/dev/null; then
VER=`dpkg-query --show $PKG | awk '{print "-" $2 }'`
fi
printf "$PKG$VER Detailed Status Navigation\n Expand all - zr\t\tCollapse all - zm\n Expand one - zo\t\tCollapse one - zc\n\n"
if [ -d "$HOME/.$PKG/bin" ]; then
DIR="$HOME/.$PKG/bin"
else
DIR="/usr/lib/$PKG"
fi
for i in `ls "$DIR"`; do
[ "$i" = "menu" ] && continue
script=`find_script $i`
short=`$script --short | sed 's/^\s*//' | sed 's/\s*$//' | sed 's/.{[^}]*}//g'` || true
detail=`$script --detail | sed '/^$/d' | sed 's/^/\t/g'` || true
printf "%s\n\t(%s)\n" "$short" "$i"
[ -n "$detail" ] && printf "%s\n" "$detail"
done
else
eval x="\$$P" || exit 1
[ "$x" = "1" ] || exit 0
. $(find_script "$P")
fi